package day06.homework.demo2;

import java.util.Date;

public class HourlyEmployee extends Emp{
    private int hours;

    private double salary;

    public HourlyEmployee() {
    }

    public HourlyEmployee(String name, Date birthday, int hours, double salary) {
        super(name, birthday);
        this.hours = hours;
        this.salary = salary;
    }

    @Override
    public double getSalary(int month){
        double total = hours * salary;
        if(hours>160)
            total+=(hours-160)*0.5*salary;
        return total+super.getSalary(month);
    }
}
